package com.lyb.jedis;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

/**
 * @author lyb
 * @create 2022/3/15-13:51
 * @method
 */
public class RedisClusterDemo {

    public static void main(String[] args) {
        // 创建集群对象
        HostAndPort hostAndPort = new HostAndPort("192.168.31.235", 6379);
        JedisCluster jedisCluster = new JedisCluster(hostAndPort);

        // 进行集群操作
        jedisCluster.set("air", "555");
        String air = jedisCluster.get("air");
        System.out.println("air = " + air);

        // 关闭集群
        jedisCluster.close();

    }
}
